package com.sj.controller;


import com.sj.dto.ArticleDto;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/article")
public class ArticleController {

    @GetMapping("/list")
    @RequiresPermissions("article:list")
    public ResponseEntity<List<ArticleDto>> list() {
        List<ArticleDto> list = new ArrayList<ArticleDto>();
        ArticleDto articleDto = new ArticleDto();
        articleDto.setId(1l);
        articleDto.setAuthor("123");
        list.add(articleDto);
        return ResponseEntity.ok().body(list);
    }

    @GetMapping("/{id}")
    public ResponseEntity<ArticleDto> read(@PathVariable Long id) {
        return null;
    }


}
